package org.wmq.transferordersystem.service.impl;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.wmq.transferordersystem.dao.OrderDao;
import org.wmq.transferordersystem.model.Entity.Order;
import org.wmq.transferordersystem.service.OrderService;

import java.util.List;

@Service
@RequiredArgsConstructor
public class OrderServiceImpl implements OrderService {
    private final OrderDao orderDao;

    @Override
    public Order getById(Long id) {
        return this.orderDao.selectById(id);
    }

    @Override
    public void save(Order order) {
        System.out.println("service:  " + order);
        this.orderDao.insert(order);
    }

    @Override
    public boolean deleteById(Long id) {
        return this.orderDao.deleteById(id);
    }

    @Override
    public void updateById(Order order) {

    }

    @Override
    public List<Order> list() {
        return this.orderDao.selectAll();

    }
}
